/*
package com.jymj.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.NameFilter;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.jymj.common.annotation.SysLog;
import com.jymj.common.validator.ValidatorUtils;
import com.jymj.common.validator.group.AddGroup;
import com.jymj.common.validator.group.UpdateGroup;
import com.jymj.entity.gantt.PjResource;
import com.jymj.entity.gantt.PjTaskEntity;
import com.jymj.service.PjResService;
import com.jymj.utils.Constant;
import com.jymj.utils.PageUtils;
import com.jymj.utils.Query;
import com.jymj.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * Created by ljj on 2017/8/14.
 *//*

@RestController
@RequestMapping("/pjRes")
public class PjResController extends AbstractController {

    @Autowired
    private PjResService pjResService;

    */
/**
     * 所有列表
     *
     * @param params
     * @return R
     *//*

    @RequestMapping("/list")
    @RequiresPermissions("sys:res:list")
    public R list(@RequestParam Map<String, Object> params) {
        //只有超级管理员，才能查看所有资源列表
        if (getUserId() != Constant.SUPER_ADMIN) {
            params.put("createUserId", getUserId());
        }

        //查询列表数据
        Query query = new Query(params);
        List<PjResource> resList = pjResService.queryList(query);
        int total = pjResService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(resList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }

    @RequestMapping("/getResTaskList/{pjid}")
    //@RequiresPermissions("sys:res:getResTaskList")
    public R getResTaskList(@PathVariable("pjid") Integer pjid) {
        List<PjResource> resList = pjResService.queryResTaskList(pjid);
        return R.ok().put("data", resList);
    }

    @RequestMapping("/getResList/{pjid}")
    //@RequiresPermissions("sys:res:getResTaskList")
    public R getResList(@PathVariable("pjid") Integer pjid) {
        List<PjResource> resList = pjResService.queryResTaskList(pjid);

        NameFilter nameFilter = (Object o, String s, Object o1) -> {
            if ("id".equals(s) && o.getClass() == PjTaskEntity.class) {
                return "resId";
            } else if ("pjid".equals(s)) {
                return "pjid";
            } else if ("title".equals(s)) {
                return "name";
            } else if ("res_id".equals(s)) {
                return "parentId";
            }
            return s;
        };
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(PjTaskEntity.class, "id", "pjid", "title", "res_id");
        SerializeFilter[] filters = {nameFilter, filter};
        String json = JSON.toJSONString(resList, filters);
        return R.ok().put("data", json);
    }

    @RequestMapping("/perms")
    @RequiresPermissions("sys:res:perms")
    public R perms() {
        //查询列表数据
        List<PjResource> menuList = pjResService.queryList(new HashMap<>());

        return R.ok().put("resList", menuList);
    }

    */
/**
     * 角色授权资源
     *
     * @return
     *//*

    */
/*@RequestMapping("/resList")
    public R resList() {
        //查询列表数据
        List<PjResource> resList = pjResService.getUserresList(getUserId());
        return R.ok().put("resList", resList);
    }*//*

    */
/**
     * 资源信息
     *
     * @param resId
     * @return R
     *//*

    @RequestMapping("/info/{resId}")
    @RequiresPermissions("sys:res:info")
    public R info(@PathVariable("resId") Long resId) {
        PjResource res = pjResService.queryObject(resId);

        return R.ok().put("res", res);
    }

    */
/**
     * 保存资源
     *
     * @param res
     * @return R
     *//*

    @SysLog("保存资源")
    @RequestMapping("/save")
    @RequiresPermissions("sys:res:save")
    public R save(@RequestBody PjResource res) {
        ValidatorUtils.validateEntity(res, AddGroup.class);
        pjResService.save(res);
        return R.ok();
    }

    */
/**
     * 修改资源
     *
     * @param res
     * @return R
     *//*

    @SysLog("修改资源")
    @RequestMapping("/update")
    @RequiresPermissions("sys:res:update")
    public R update(@RequestBody PjResource res) {
        ValidatorUtils.validateEntity(res, UpdateGroup.class);
        pjResService.update(res);
        return R.ok();
    }

    */
/**
     * 删除资源
     *
     * @param resIds
     * @return R
     *//*

    @SysLog("删除资源")
    @RequestMapping("/delete")
    @RequiresPermissions("sys:res:delete")
    public R delete(@RequestBody Long[] resIds) {
        pjResService.deleteBatch(resIds);
        return R.ok();
    }

}
*/
